package burubaka.common.coder;

import java.util.Date;
import java.util.TimeZone;

import org.slim3.datastore.json.Default;
import org.slim3.datastore.json.JsonWriter;
import org.slim3.util.DateUtil;
import org.slim3.util.TimeZoneLocator;

public class DateCoder extends Default {

	@Override
	public void encode(JsonWriter writer, Date value) {
		TimeZone.setDefault(TimeZoneLocator.get());
		writer.writeString(value != null ? DateUtil.toString(value, "yyyy-MM-dd HH:mm:ss") : "");
	}
}
